<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="utf-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <!-- The above 3 meta tags *must* come first in the head; any other head content must come *after* these tags -->
  <meta name="description" content="">
  <meta name="author" content="">
  <link rel="icon" href="../../favicon.ico">

  <title>农场后台人员系统</title>

  <!-- Bootstrap core CSS -->
  <link rel="stylesheet" href="/bower_components/bootstrap/dist/css/bootstrap.min.css">

  <!-- IE10 viewport hack for Surface/desktop Windows 8 bug -->

  <!-- Custom styles for this template -->
  <link rel="stylesheet" href="/bower_components/bootstrap/docs/examples/signin/signin.css">

  <!-- Just for debugging purposes. Don't actually copy these 2 lines! -->
  <!--[if lt IE 9]><![endif]-->


  <!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
  <!--[if lt IE 9]>

  <![endif]-->
  <style type="text/css">
    body{
      background-image: url("/bower_components/image/3.jpg");
      background-size: 100%;
    }
    .ndTitle{
      text-align: center;
    }
    .bugP{
      color: red;
      text-align: center;
    }
    .checkbox{
      color: #ffffff;
    }
    #loginA{
      color: #ffffff;
      float: right;
      padding-right: 3px;
    }
    #inputUsername,#OnePassword,#TwoPassword,#email,#mobile{
      margin-bottom: 2px;
    }
  </style>


</head>

<body>

<div class="container">

  <form class="form-signin">
    <h2 class="form-signin-heading ndTitle">农场人员后台系统</h2>
    <p class="bugP"></p>
    <label for="inputUsername" class="sr-only">用户名</label>
    <input type="text" id="inputUsername" class="form-control" placeholder="请输入用户名" required autofocus>
    <label for="OnePassword" class="sr-only">密码</label>
    <input type="password" id="OnePassword" class="form-control" placeholder="请输入密码" required>
    <label for="TwoPassword" class="sr-only">确认密码</label>
    <input type="password" id="TwoPassword" class="form-control" placeholder="请确认密码" required>
    <label for="email" class="sr-only">邮箱</label>
    <input type="email" id="email" class="form-control" placeholder="请输入邮箱" required>
    <label for="mobile" class="sr-only">手机</label>
    <input type="email" id="mobile" class="form-control" placeholder="请输入手机号码" required>


    <div class="checkbox">
      <label>
        <input type="checkbox" value="remember-me"> 记住我
      </label>
      <a id="loginA" href="/user/loginUI">去登陆</a>
    </div>

    <button id="regId" class="btn btn-lg btn-primary btn-block" type="button">注册</button>
  </form>

</div> <!-- /container -->

<!-- jQuery 3 -->
<script src="/bower_components/jquery/dist/jquery.min.js"></script>
<!-- Bootstrap 3.3.7 -->
<script src="/bower_components/bootstrap/dist/js/bootstrap.min.js"></script>

<script type="text/javascript">
  $(function () {
    $("#regId").click(reg);
  });
  function reg() {
    var onePwd=$("#OnePassword").val();
    var twoPwd=$("#TwoPassword").val();
    if (onePwd!=twoPwd){
      $(".bugP").html("密码不一致");
      return;
    }
    var url="/user/doReg";
    var param={
      username:$("#inputUsername").val(),
      password:onePwd,
      email:$("#email").val(),
      mobile: $("#mobile").val()
    }
    $.post(url,param,function (result) {
      if (result.message=="NO"){
        alert("注册失败")
        $(".bugP").html("注册失败，请重新输入");
      }else{
        location.href="/user/loginUI?t="+Math.random();
      }
    });
    // var url="/user/doLogin";
    // var param={
    //   username:$("#inputUsername").val(),
    //   password:$("#inputPassword").val()
    // }
    // console.log(param);
    //

    //
    //
    // // $(".bugP").html("您输入的用户名或密码错误");
  }

</script>

</body>
</html>
